home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d7 / auto_log.arc / IBM.SLT < prev    next >
Text File  |  1991-07-24  |  8KB  |  181 lines

  1. ////////////////////////////// PCBOARD.SLT ///////////////////////////////////
  2. //
  3. //  PCBBOARD.SLT Copyright (C) 1990 Liberation Enterprises.
  4. //
  5. //  DESCRIPTION:  This Telix script is designed to logon to a PCBoard v14
  6. //  based BBS system.  It will take you from the initial PCBoard connection
  7. //  to the main menu (or conference main menu, if defined below).
  8. //
  9. //  INSTRUCTIONS:  Simply change the variables below to the desired values and
  10. //  compile for use with Telix with the command CS PCBOARD.  The script
  11. //  should also be linked to your Telix dialing directory.  Enter PCBOARD.SLC
  12. //  in the 'Linked Script' item of PCBoard directory entries to do so.
  13. //  Telix will then automatically run PCBOARD.SLC when you connect to the BBS.
  14. //  Your PCBoard password must also be placed in each directory entry, near
  15. //  the bottom.
  16. ////
  17.  
  18. int d = 2,      // response delay... 10ths/sec same as in The Liberator.
  19.                 // Increase to 5 or 10 if the script responds to questions
  20.                 // too quickly.
  21.     pager = 1;  // Change the 0 to a 1 to have an alarm sound when the
  22.                 // logon completes.
  23.  
  24. str user_name[] =  "PETER POKLETAR", // Place your PCBoard user name here.
  25.     lang_num[] =   "3",           // Ignore if only one language on the board.
  26.     ansi_graph[] = "Y Q",          // ANSI Color?  Y = Yes, N = No.
  27.     conference[] = "J 2";           // Conference to join at logon: "" = None.
  28.  
  29. ////
  30. //
  31. //  Everything from this point on may be ignored.  See the track() statements
  32. //  below to modify prompts if necessary...  Make sure you compile this script
  33. //  whenever any changes are made.
  34. //
  35. //////////////////////////////////////////////////////////////////////////////
  36. main()
  37. {
  38.  int timeout,                    // int for a timer handle
  39.      success = 0,                // set to FALSE (0)--TRUE if successful logon
  40.      pass_tries = 3,             // in case of a bad password... when 0 give up
  41.      prompt,                     // stores track handles found by track_hit()
  42.      language,                   // ints used as track() handles
  43.      graphics,
  44.      name,
  45.      correct,
  46.      password,
  47.      more,
  48.      scan_msg,
  49.      pause,
  50.      pcb_main,
  51.      pcb_conf;
  52.  str s[10];                      // general purpose string
  53.  
  54.  clear_scr();
  55.  
  56.  if (not _entry_pass)          // can't log on without a password
  57.   {
  58.    prints("Password Unknown.  Please put it in your dialing directory and try again.");
  59.    return(6);
  60.   }
  61.  
  62.  // Define which prompts to look for.  Each string being 'tracked' will be
  63.  // assigned a number (from 1-16), and the number is used to refer to the
  64.  // string being tracked, instead of using the actual string each time.  So,
  65.  // 'language' will equal 1, and will refer to the first string being track()ed
  66.  // (the language prompt).  'graphics' will be assigned the number 2, and will
  67.  // refer to whatever the second track() is outlined to watch for, etc.  The
  68.  // values assigned by track() are known as track 'handles', since they are
  69.  // a shortform (handle) used to refer to another item (the string being
  70.  // tracked).
  71.  
  72.  language = track("(Enter)=no change? ", 1); // Language # to use
  73.  graphics = track("(Enter)=no? ", 2);        // Graphics prompt
  74.  name     = track("first name? ", 3);        // Name prompt
  75.  correct  = track("Is this correct", 4);     // silly prompt used by some
  76.  password = track("Dots will", 5);           // Password prompt
  77.  more     = track("More? ", 6);              // Bulletin pause prompt
  78.  scan_msg = track("(Enter)=yes? ", 7);       // Scan Message Base
  79.  pause    = track("(Enter) to continue", 8); // Press (Enter) to continue?
  80.  pcb_main = track("Main Board Command? ", 9);
  81.  pcb_conf = track("Conference Command? ", 10);
  82.  
  83.  timeout  = timer_start(1800);  // 3 min. maximum for logon... give up if time
  84.                                 // expires. 'timeout' is another 'handle'
  85.                                 // (separate from track handles) used to refer
  86.                                 // to this specific timer (up to 10 timers can
  87.                                 // be running at once... each with its own
  88.                                 // 'handle').
  89.  
  90.  
  91.  while (not time_up(timeout) and carrier())
  92.   {
  93.  
  94.  // while time_up(timeout) is 'not TRUE' (false) and carrier() is TRUE...
  95.  //  do what's between while's braces ({})
  96.  
  97.    terminal();                // if you don't use this, Telix won't be
  98.                               // able to see any characters, and to nothing
  99.                               // gets displayed on your screen.
  100.  
  101.    prompt = track_hit();      // check which prompt (if any) was found.  If one
  102.                               //  was, its handle number is stored in 'prompt'
  103.                               // if not, prompt == 0 (is equal to 0)
  104.  
  105.    if (prompt == language)    // if prompt 'is equal to' the language handle
  106.     cputs_cr(lang_num);       // (the number 1, since it's the first track())
  107.  
  108.    else if (prompt == graphics)
  109.     {
  110.      s = ansi_graph;          // put ansi_graph (defined above) in 's'
  111.      strcat(s, "");         //  then strCAT (concatenate... add) " Q" to 's'
  112.      cputs_cr(s);             //  for a 'Q'uiet logon (no welcome screen)
  113.     }
  114.  
  115.    else if (prompt == name)
  116.     cputs_cr(user_name);
  117.  
  118.    else if (prompt == correct)
  119.     cputs_cr("Y");
  120.  
  121.    else if (prompt == password)
  122.     {
  123.      if (not pass_tries)      // a little extra protection... in case
  124.       break;                  //  you enter the wrong password in your
  125.      cputs_cr(_entry_pass);   //  dialing directory, it will only be tried
  126.      --pass_tries;            //  3 times before the script gives up.
  127.     }                         //  '--pass' is the same as 'pass = pass - 1'
  128.  
  129.    else if (prompt == more or prompt == scan_msg)  // note use of 'or'
  130.     cputs_cr("N");
  131.  
  132.    else if (prompt == pause)
  133.     cputs_cr("F");
  134.  
  135.    else if (prompt == pcb_main)
  136.     {
  137.      if (conference)          // if conference isn't empty ("")
  138.       {
  139.        s = "";
  140.        strcat(s, conference);
  141.        strcat(s, "");
  142.        cputs_cr(s);
  143.        conference = "";      // clear in case we can't join, so we don't try
  144.       }                      //  forever
  145.      else
  146.       {
  147.        success = 1;           // made it to the main menu... and not J)oining
  148.        break;                 // a conf.  All done... exit (break from) loop
  149.       }
  150.     }
  151.  
  152.    else if (prompt == pcb_conf)
  153.     {
  154.      success = 1;             // made it to the conf. menu
  155.      break;                   // all done... exit loop
  156.     }
  157.   }                           // here's the closing } for while 'loop'
  158.  
  159.  track_free();                // tell Telix to stop tracking everything
  160.  timer_free(timeout);         // and to release the timer.
  161.  
  162.  if (pager)                   // if the variable 'pager' is not FALSE (0)
  163.   alarm(3);                   //  sound a pager to get the operator
  164.  
  165.  if (success)                 // if 'success' is TRUE (not zero), then
  166.   return(0);                  //  we made it, return zero
  167.  
  168.  return(29);                  // otherwise, send bad logon abort code
  169. }
  170.  
  171. //////////////////////////////////////////////////////////////////////////////
  172. cputs_cr(str response)
  173. {
  174.  delay_scr(d);     // response delay... set at beginning of script
  175.  if (response)
  176.   cputs(response);
  177.  cputc('^M');
  178. }
  179.  
  180. /////////////////////////////// End of File //////////////////////////////////
  181.